//
// Created by liushuai on 2021/1/12.
//

#include "missingNumber.h"
#include <vector>
int missingNumber(std::vector<int>& nums){
    int nums_size = nums.size();
    int lower = 0;
    int upper = nums_size-1;
    while(lower<=upper){
        int mid = (upper+lower)/2;
        if(nums[mid]== mid)
            lower = mid+1;
        else
            upper = mid-1;
    }
    return lower;
}